# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=spdlog
pkgver=1.9.2
pkgrel=0
pkgdesc="Fast C++ logging library"
url="https://github.com/gabime/spdlog"
arch="all"
license="MIT"
makedepends="cmake fmt-dev"
subpackages="$pkgname-dev"
source="https://github.com/gabime/spdlog/archive/v$pkgver/spdlog-v$pkgver.tar.gz"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DSPDLOG_BUILD_BENCH=OFF \
		-DSPDLOG_BUILD_TESTS=ON \
		-DSPDLOG_SANITIZE_ADDRESS=OFF \
		-DSPDLOG_FMT_EXTERNAL=ON \
		-DSPDLOG_BUILD_SHARED=ON \
		-DSPDLOG_BUILD_EXAMPLE=OFF
	cmake --build build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	sed -e 's|.*#define SPDLOG_FMT_EXTERNAL|#define SPDLOG_FMT_EXTERNAL|' \
		-i "$pkgdir"/usr/include/spdlog/tweakme.h
}

sha512sums="
87b12a792cf2d740ef29db4b6055788a487b6d474662b878711b8a5534efea5f0d97b6ac357834500b66cc65e1ba8934446a695e9691fd5d4b95397b6871555c  spdlog-v1.9.2.tar.gz
"
